#ifndef __POS_PARAM_H__
#define __POS_PARAM_H__

#include "gd32e23x.h"

#define Model_Time_Base 50     

 
typedef struct SCardPurseParam
{
    uint8_t Sector;      //扇区
    uint8_t DataType;  
    uint8_t KeyType;   
    uint8_t Key[6];    
} TCardPurseParam;

 
typedef struct SPosParam
{
     
    TCardPurseParam M1Purse;
    TCardPurseParam M1PurseSub;
    TCardPurseParam CPUPurse;
    uint16_t AuthCode;
    uint8_t PosIP[2];
    uint8_t CPU_B;
    uint8_t Prev_UID;
     
     

    uint8_t MeasureMode;           
    uint16_t OutPulse;             
    uint16_t OutFee;               

    uint8_t PosMult16;             
    uint16_t StopSec;               
    uint8_t BackLight;	            
    uint8_t ChargeDelay;           
    uint8_t EnableUserCard;        

    uint16_t DayLimit;            
    uint8_t DayLimitFlag;          

    uint8_t FreeUseFee;            
    uint8_t FreeUsePluse;            
    uint8_t FreeUseMode;           
    uint16_t FreeUseTotal ;         
	uint16_t FreeRemWarn;           
    uint8_t FreeUseMonFlag;        

    uint8_t SpecDeduFee;		    
    uint8_t SpecDeduPulse;         
    uint8_t SpecDeduMode;          
    uint8_t SpecDeduInCrad;        

    uint8_t RationModeFee;         
    uint16_t RationModeTime;       
    uint8_t RationMode;            
    uint8_t RationInCrad;          

    uint16_t RetenMoney;            
    uint8_t RetenMoneyFlag;        
    uint16_t MaxBalance;            
    uint8_t MaxBalance_Flag;       

    uint16_t PulsesPerLiter;        
    uint8_t LiterDisplay;          
    uint32_t Amtall;              
#ifdef DUAL_MODE    
    uint8_t  Dual_RationMode;          
    uint16_t Dual_1RationModeFee;      
    uint16_t Dual_1RationModeTime;     
    uint16_t Dual_2RationModeFee;      
    uint16_t Dual_2RationModeTime;     
    
    uint8_t  DualMode;          
    uint8_t  DualControlMode_1;       
    uint8_t  DualControlMode_2;       
    uint16_t Out1Pulse;             
    uint16_t Out1Fee;               
    uint16_t Out2Pulse;             
    uint16_t Out2Fee;               

    uint8_t PulseOutMode;   
    uint8_t PosMult16_2;
    uint8_t DualControlMode;  
#endif
    Proc SaveParam;
     
    Proc ReadParam;
     
    uint8_t NFC_Gain;      
#ifndef SEGLCD
    uint8_t LedLumin;
#endif
} TPosParam;
extern volatile TPosParam PosParam;

#ifdef DUAL_MODE   
typedef struct sDualRatMode
{
    uint8_t Incr;
    uint8_t IncrVal;
    uint8_t IncrVal2;
} tDualRatMode;
extern volatile tDualRatMode DualRatMode;
#endif

extern uint8_t CPUReadBuf[64];

void InitPosParam();
void SetFactory();
void SaveAmountFun();
void ReadAmountFun();
void ReadStandbyFlag();

#endif
